﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Dart
{
    class DartPlayer
    {
        private String cName;
        private int cScore;
        private Label labelPlayerName = new Label();
        private Label labelPlayerScore = new Label();

        public DartPlayer(int id, String name, int score, Form parentForm)
        {
            int top = 15;
            int left = 15;
            this.SetName(name);
            this.SetScore(score);

            labelPlayerName.ForeColor = System.Drawing.Color.Gray;
            labelPlayerName.BackColor = System.Drawing.Color.Black;
            labelPlayerName.Font = new System.Drawing.Font("Courier New", 57F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            labelPlayerName.ForeColor = System.Drawing.Color.Gray;
            labelPlayerName.Location = new System.Drawing.Point(left, top + 117 * (id - 1));
            labelPlayerName.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
            labelPlayerName.Name = name + id;
            labelPlayerName.Size = new System.Drawing.Size(500, 108);
            labelPlayerName.Text = name;
            labelPlayerName.Tag = id;

            parentForm.Controls.Add(labelPlayerName);

            labelPlayerScore.BackColor = System.Drawing.Color.Black;
            labelPlayerScore.ForeColor = System.Drawing.Color.Gray;
            labelPlayerScore.Font = new System.Drawing.Font("Courier New", 57F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            labelPlayerScore.Location = new System.Drawing.Point(labelPlayerName.Left + labelPlayerName.Width + 5, top + 117 * (id - 1));
            labelPlayerScore.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
            labelPlayerScore.Name = "labelScorePlayer" + id;
            labelPlayerScore.Size = new System.Drawing.Size(193, 108);
            labelPlayerScore.Text = score.ToString();
            ToolTip t = new ToolTip();
            t.SetToolTip(labelPlayerScore, "Punkte Spieler " + id+1);

            parentForm.Controls.Add(labelPlayerScore);
        }

        
        public void SetName(String name)
        {
            cName = name;
        }

        public String GetName()
        {
            return cName;
        }

        public void SetScore(int score)
        {
            cScore = score;
        }

        public int GetScore()
        {
            return cScore;
        }

        public String GetScoreToString()
        {
            return cScore.ToString();
        }

        public void RefreshPlayerName(Label playerName)
        {
            playerName.Text = this.GetName();
        }

        public void RefreshPlayer()
        {
            this.RefreshPlayerName();
            this.RefreshPlayerScore();
        }

        public void RefreshPlayerName()
        {
            this.labelPlayerName.Text = this.GetName();
        }

        public void RefreshPlayerScore()
        {
            this.labelPlayerScore.Text = this.GetScoreToString();
        }

        public Label GetPlayerNameLabel()
        {
            return this.labelPlayerName;
        }

        public Label GetPlayerScoreLabel()
        {
            return this.labelPlayerScore;
        }
    }
}
